﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kristall.Managers;

namespace Kristall.Screens
{
    public class OptionsScreen : MenuScreen
    {
        MenuEntry fullScreen;
        bool isFullScreen;

        string makeNice(bool value)
        {
            return value == true ? "Yes" : "No";
        }

        public OptionsScreen() : base("Options")
        {
            fullScreen = new MenuEntry("");
            isFullScreen = Kristall.Options.gfx_fullscreen;
            fullScreen.OnSelect += new EventHandler(fullScreen_OnSelect);

            MenuEntry save = new MenuEntry("Save Changes");
            save.OnSelect += new EventHandler(save_OnSelect);

            MenuEntry back = new MenuEntry("Back");
            back.OnSelect += new EventHandler(OnCancel);

            updateText();

            MenuEntries.Add(fullScreen);
            MenuEntries.Add(save);
            MenuEntries.Add(back);
        }

        void updateText()
        {
            fullScreen.Text = "Full Screen: " + makeNice(isFullScreen);
        }

        void save_OnSelect(object sender, EventArgs e)
        {
            Kristall.Options.Save();

            Kristall.GraphicsDeviceManager.IsFullScreen = Kristall.Options.gfx_fullscreen = isFullScreen;
            Kristall.GraphicsDeviceManager.ApplyChanges();
        }

        void fullScreen_OnSelect(object sender, EventArgs e)
        {
            isFullScreen = !isFullScreen;
            updateText();
        }


    }
}
